{extend name="public/common"} {block name="body"}
<title>基本设置</title>
</head>
<style type="text/css">
	.bg-1 {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
}
 .radius:hover{
 	background:#e5e5e5;
 	border-color: #e5e5e5;
 	color: #333;
 }
 span:hover{
 	color: #333;
 }
.btn-primary {
	border-radius: 5px;
}
.btn-primary:hover {
	color: #fff;
	border-color: #66b1ff;
	background-color: #66b1ff;
}
 .btn-primary {
    color: #fff;
	background-color: #409eff;
    border-color: #409eff;
    height: 31px;
    border-radius: 5px;
    font-size: 14px;
    line-height: 24px !important;
}
</style>
<body>
  <nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    
    彩票管理
    <span class="c-gray en">&gt;</span>
    开奖结果
{if condition="$stua eq 1"}
    <span class="c-gray en">&gt;</span>
    彩种未结算
{/if}
    <a class="btn btn-success radius r"
      style="line-height: 1.6em; margin-top: 3px"
      href="javascript:location.replace(location.href);" title="刷新">
      <i class="Hui-iconfont">&#xe68f;</i>
    </a>
  </nav>
  <div style="padding:20px;height:30px;">
  	
  	<div class="new_box">
<div class="text-c" style="padding :20px 0;">
    <div  style="width:217px;" class="formControls col-xs-8 col-sm-9"> 
    	<span class="select-box">
			<select class="select" name="id" id="code">
			{volist name="caizhong" id="vo"}
				<option value="{$vo.id}" {if condition="input('get.id') == $vo.id"}selected{/if}>{$vo.cp_name_new ? $vo.cp_name_new : $vo.cp_name_old}</option>
			{/volist}
			</select>
		</span> 
	</div>
	 <form action="/admin/lottery/cz_kjjg" enctype="application/x-www-form-urlencoded" method="post" class="l" style="margin-left:20px;">
    <input type="text" name="qihao" id="qihao" value="{$qihao}" id="" placeholder="期号搜索" style="width:150px" class="input-text">
    <button class="btn btn-success" type="submit" style="margin-right:20px;"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
  </form>
  <span class="l"  style="margin-left: 20px;">
			<a class="btn btn-primary " data-title="线上待支付列表" href="{:url('lottery/cz_kjjg')}?stua=1&id={$id}">彩种未结算</a>
		</span>
		
  </div>

     <div class="page-container  dataTables_wrapper" style="position: relative;">
      <div id="tab-system" class="HuiTab">
        <div class="tabCon">
          <div class="mt-20">
            <table
              class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
              <thead>
                <tr class="text-c">
                  <th>ID</th>
                  <th>期数</th>
                  <th>开奖号码</th>
                  <th>预设号码</th>
                  <th>未结算投注金额</th>
                  <th>投注</th>
                  <th>结算</th>
                  <th>操作</th>

                  <th>手动结算</th>
                </tr>
              </thead>
            {volist name="list" id="KJ"}
              <tbody>
                <tr class="text-c">
                  <td>{$KJ.id}</td>
                  <td>{$KJ.qihao}</td>
                  <td>
                  	<div style="width:auto;margin:0 auto;text-align: center;">
                  		  {if(!$KJ.kjjg)}
                  		待开奖
                  {else/}
                  {foreach($KJ.kjjg as $it)}
                  <div style='width:20px;height:20px;line-height:20px;text-align:center;border-radius:50%;background:red;color:white;display:inline-block;margin-left:10px;'>{$it}</div>
                  {/foreach}
                  {/if}
                  	</div>
                  
                  </td>
                  <td>{$KJ.ps}</td>
                   <td>{$KJ.touzhu}</td>
                   <td>{$KJ.jztime < time() ? '已截止' : '正常投注'}</td>   
                   <td>
                   {if($KJ.touzhu>0 || $KJ.iftz<1)}未结算{/if}
                   {if($KJ.iftz==1)}已结算{/if}
                   {if($KJ.iftz>1)}已退款{/if}
          
                   </td> 
                   <td>
	                     {if condition="$KJ['iftz']<1"}
						<a href="javascript:;"onclick="if(confirm('是否确认操作？')) {window.location.href='/admin/lottery/cz_kjth?czid={:input('get.id') ? input('get.id') : $caizhong.0.id}&qihao={$KJ.qihao}'}" title='退还所有未结算的本金'>退</a>
					 	<a href='javascript:void(0);' onclick='open_zhixing({$KJ.id})' title='手工开奖'>手</a>
						{else/}
						禁止操作
            <a href='javascript:void(0);' onclick='chongkaijian({$KJ.id})' title='手工重新开奖'>（重新开奖）</a>
						{/if}
                   </td>
                   <td>
                   		{if($KJ.kjjg && $KJ.touzhu>0)}
                   		<a href="javascript:;"onclick="if(confirm('六合彩开奖时间：21:30:00到22：00，七星彩开奖时间：20:30:00到21：00，其他彩种任意时间可以开奖，是否确认操作？')) {window.location.href='/admin/lottery/jiesuan?czid={:input('get.id') ? input('get.id') : $caizhong.0.id}&qihao={$KJ.qihao}'}" title='结算未结算的投注'>结算</a>
                   		{/if}
                   </td>
                </tr>
              {/volist}
              </tbody>
            </table>
          </div>
        </div>
      </div>
      	<div class="dataTables_paginate paging_simple_numbers" style="width:100%;">
      		<div style="float:left;">  
                      每页显示<select name="limit" style="height:26px;" id="code1">
                      	<option value="20" {if condition="$limit eq 20"}selected{/if}>
                20
              </option>
              <option value="50" {if condition="$limit eq 50"}selected{/if}>
                50
              </option>
              <option value="100" {if condition="$limit eq 100"}selected{/if}>
                100
              </option>
                       </select>条
                      </div>
            <span style="float:right;margin-left:-2px;">总共{$list->lastPage()}页  当前第{$list->currentPage()}页 ，共{$list->total()}条</span>
            <div style="float:left;">{$list->render()}</div>
    	</div>
    </div>
    

    
	<div
	style="width: 500px; height: 220px; border: #cccccc solid 8px; position: absolute;top: 0; z-index: 9999; float: left; left: 50%; margin-top: 200px; margin-left: -200px; background: #FFFFFF; border-radius: 10px; display: none"
	id="zhixing_tuihui">
	<div
		style="width: 460px; height: 40px; margin: auto; line-height: 40px; border-bottom: 3px #ea721a solid;">
		<div
			style="width: 460px; float: left; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal">
			<h6>手工开奖</h6>
			<span
				style="width: 18px; height: 18px; display: block; position: absolute; top: 15px; right: 20px; cursor: pointer; background: url(sysmet/template/img/mdl-icon.png) no-repeat -11px -80px;"
				onclick="guanbi()" class='gb'></span>
		</div>
	</div>




	<div style="width: 480px; height: 140px; margin: auto; line-height: 35px; text-align: center; font-size: 13px; font-weight: 600">
		彩种：{$CZNAME}
		</br>
		期数：
		<span id="qishul">加载中...</span>
		期
		<br />
		开奖号码：
		<input name="" value="" id="sgkj_kjjg"
			style="width: 180px; text-align: center" />
		<input type="hidden" id="sgkj_qihao" value="" />
		<input type="hidden" id="sgkj_czid" value="{$czid}" />
		<!-- <button onclick="sgkjykjs()" type="button"
			class="am-btn am-btn-success am-radius "
			style="width: 80px; font-size: 12px; height: 30px">计算盈亏</button> -->
		<button onclick="shougongkaij()" type="button"
			class="am-btn am-btn-success am-radius "
			style="width: 60px; font-size: 12px; height: 30px">确定</button>
			<br/>
		<span id="sgkj_jsjg"></span><span style="color:red;">{if(input('get.id')== 1 || input('get.id')== 8 || input('get.id')== 62)}0,2,3,5,7{/if}
		{if(input('get.id')== 4 || input('get.id')== 61 || input('get.id')== 63)}01,02,03,05,07,04,08,09,10,06{/if}
		{if(input('get.id')== 9)}01,23,35,15,17,05,42{/if}
		{if(input('get.id')== 10)}1,2,3,=,6{/if}
		{if(input('get.id')== 51)}1,4,5,7,4,3,9{/if}
		{if(input('get.id')== 16 || input('get.id')== 25 || input('get.id')== 28)}10,08,03,11,06{/if}
		{if(input('get.id')== 36 || input('get.id')== 44 || input('get.id')== 72 || input('get.id')== 5 || input('get.id')== 7 || input('get.id')== 48)}1,2,6{/if}</span>
		<br/>
		开奖结果用逗号隔开<br/>
		
		
	</div>


</div>	 
<div
  style="width: 500px; height: 220px; border: #cccccc solid 8px; position: absolute;top: 0; z-index: 9999; float: left; left: 50%; margin-top: 200px; margin-left: -200px; background: #FFFFFF; border-radius: 10px; display: none"
  id="zhixing_tuihui_n">
  <div
    style="width: 460px; height: 40px; margin: auto; line-height: 40px; border-bottom: 3px #ea721a solid;">
    <div
      style="width: 460px; float: left; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal">
      <h6>手工重新开奖</h6>
      <span
        style="width: 18px; height: 18px; display: block; position: absolute; top: 15px; right: 20px; cursor: pointer; background: url(sysmet/template/img/mdl-icon.png) no-repeat -11px -80px;"
        onclick="guanbi_n()" class='gb'></span>
    </div>
  </div>




  <div style="width: 480px; height: 140px; margin: auto; line-height: 35px; text-align: center; font-size: 13px; font-weight: 600">
    彩种：{$CZNAME}
    </br>
    期数：
    <span id="qishul_n">加载中...</span>
    期
    <br />
    开奖号码：
    <input name="" value="" id="sgkj_kjjg_n"
      style="width: 180px; text-align: center" />
    <input type="hidden" id="sgkj_qihao_n" value="" />
    <input type="hidden" id="sgkj_czid_n" value="{$czid}" />
    <!-- <button onclick="sgkjykjs()" type="button"
      class="am-btn am-btn-success am-radius "
      style="width: 80px; font-size: 12px; height: 30px">计算盈亏</button> -->
    <button onclick="chongxinkj()" type="button"
      class="am-btn am-btn-success am-radius "
      style="width: 60px; font-size: 12px; height: 30px">确定</button>
      <br/>
    <span id="sgkj_jsjg_n"></span><span style="color:red;">{if(input('get.id')== 1 || input('get.id')== 8 || input('get.id')== 62 || input('get.id')=='')}0,2,3,5,7{/if}
    {if(input('get.id')== 4 || input('get.id')== 61 || input('get.id')== 63)}01,02,03,05,07,04,08,09,10,06{/if}
    {if(input('get.id')== 9)}01,23,35,15,17,05,42{/if}
    {if(input('get.id')== 10)}1,2,3,=,6{/if}
    {if(input('get.id')== 51)}1,4,5,7,4,3,9{/if}
    {if(input('get.id')== 16 || input('get.id')== 25 || input('get.id')== 28)}10,08,03,11,06{/if}
    {if(input('get.id')== 36 || input('get.id')== 44 || input('get.id')== 72 || input('get.id')== 5 || input('get.id')== 7 || input('get.id')== 48)}1,2,6{/if}</span>
    <br/>
    开奖结果用逗号隔开<br/>
    
    
  </div>

  
</div>  
</div>
    </div>

	    <div class="zhezhao" style="width: 1702px;height: 1000px;background-color: black;position: fixed;top: 0;left: 0;z-index: 99;opacity: 0.6;display: none;"></div>

{/block}{block name="js"}
<script type="text/javascript">
$("#code").on('change',function(){
	var id = $(this).find('option:selected').val();
	window.location.href="/admin/lottery/cz_kjjg?id="+id;
})
    $(function() {
  $('.skin-minimal input').iCheck({
    checkboxClass : 'icheckbox-blue',
    radioClass : 'iradio-blue',
    increaseArea : '20%'
  });
  $("#tab-system").Huitab({
    index : 0
  });
});
</script>
<script type="text/javascript">
	function open_zhixing(tid) {
		$('#qishul').html("加载中...");
		$('#sgkj_jsjg').html("");
		$.ajax({
			type : "POST",
			url : "/admin/lottery/cz_sgkjcx?id=" + tid,
			success : function(data) {
				$('#qishul').html(data);
				document.getElementById('sgkj_qihao').value = data;

			}
		});
		$('#zhenzao').show();
		$('#zhixing_tuihui').show();

		$(".zhezhao").css('display','block');

	}
	function chongkaijian(tid) {
    $('#qishul_n').html("加载中...");
    $('#sgkj_jsjg_n').html("");
    $.ajax({
      type : "POST",
      url : "/admin/lottery/cz_sgkjcx?id=" + tid,
      success : function(data) {
        $('#qishul_n').html(data);
        document.getElementById('sgkj_qihao_n').value = data;

      }
    });
    $('#zhenzao').show();
    $('#zhixing_tuihui_n').show();

    $(".zhezhao").css('display','block');

  }
	$(".zhezhao").click(function(){
		$(this).css('display','none');
		$('#zhixing_tuihui').css('display','none');
	})
	
	function guanbi() {
		$('#zhenzao').hide();
		$('#zhixing_tuihui').hide();

	}
  function guanbi_n() {
    $('#zhenzao').hide();
    $('#zhixing_tuihui_n').hide();

  }
	function sgkjykjs() {

		var QIHAO = document.getElementById('sgkj_qihao').value;

		var CZID = document.getElementById('sgkj_czid').value;

		var KJJG = document.getElementById('sgkj_kjjg').value;

		$('#sgkj_jsjg').html("数据不足不能进行计算");
	}

	function shougongkaij() {

		var QIHAO = document.getElementById('sgkj_qihao').value;

		var CZID = document.getElementById('sgkj_czid').value;

		var KJJG = document.getElementById('sgkj_kjjg').value;

		$.ajax({
			type : "POST",
			url : "{:url('lottery/cz_sgkj')}",
			data:{"qihao":QIHAO,"czid":CZID,"kjjg":KJJG},
			success : function(data) {
				if(data==1){
					alert('手动开奖成功');
					window.location.href="{:url('lottery/cz_kjjg')}?id="+CZID;
				}else{
					$('#sgkj_jsjg').html(data);
				}
			}
		});


	}
	function chongxinkj() {

    var QIHAO = document.getElementById('sgkj_qihao_n').value;

    var CZID = document.getElementById('sgkj_czid_n').value;

    var KJJG = document.getElementById('sgkj_kjjg_n').value;

    $.ajax({
      type : "POST",
      url : "{:url('lottery/cz_cxkj')}",
      data:{"qihao":QIHAO,"czid":CZID,"kjjg":KJJG},
      success : function(data) {
        if(data==1){
          alert('手动重新开奖成功');
          window.location.href="{:url('lottery/cz_kjjg')}?id="+CZID;
        }else{
          $('#sgkj_jsjg_n').html(data);
        }
      }
    });


  }
	
	$(".gb").click(function(){
		$(".zhezhao").css("display",'none');
	})
</script>
<script>
$(function(){
var qihao=$("#qihao").val();

var li=$(".am-pagination").children();
  for (i = 0; i < li.length; i++) {
        
        var url=li.eq(i).attr('href');
        if(url){
          li.eq(i).attr('href',url+'&&qihao='+qihao);
        }       
    }
  
})
$("#code1").on('change',function(){
    var qihao=$("#qihao").val();
    var id = $("#code").find('option:selected').val();
    var total=$("#code1").find('option:selected').val();
    window.location.href="/admin/lottery/cz_kjjg?qihao="+qihao+"&limit="+total+"&id="+id;
  })
</script>
{/block}
